import redisClient from "../redis.js";
import {v4 as uuidv4} from "uuid"
import MyError from "../exception/index.js";
import {NO_AUTH_ERROR_CODE} from "../exception/errorCode.js";

export const setToken = async (key,value)=>{
    console.log("成功添加token")
    return await redisClient.set(key, value)
}

export const getToken = (key)=>{
    return new Promise((resolve, reject) => {
        redisClient.get(key, (error, value) => {
            if (error) {
                reject(error);
            } else {
                resolve(value);
            }
        });
    });
}
